package com.jh3502.helper.function.login;

import android.os.Bundle;
import android.os.Handler;
import android.widget.TextView;

import com.jh3502.helper.BuildConfig;
import com.jh3502.helper.R;
import com.jh3502.helper.base.BaseActivity;
import com.jh3502.helper.utils.Utils;

import butterknife.BindView;
import butterknife.ButterKnife;

/**
 * author:harisucici on 2018/8/3 12:00
 * email:harisucici@gmail.com
 * name:
 * todo:
 */
public class SplashActivity extends BaseActivity {
    @BindView(R.id.splash_version)
    TextView splashVersion;
    private int time = 3000;

    @Override
    protected int setViewId() {
        return R.layout.activity_splash;
    }

    @Override
    protected void initView() {
        splashVersion.setText(getResources().getString(R.string.app_name) + BuildConfig.VERSION_NAME);

    }

    @Override
    protected void initData() {
        // 闪屏的核心代码
        new Handler().postDelayed(new Runnable() {
            @Override
            public void run() {
                Utils.getInstance().startActivity(SplashActivity.this, LoginActivity.class, true);
            }
        }, time); //启动动画持续3秒钟
    }

    @Override
    protected void doOnDestroy() {

    }

    @Override
    protected void doOnResume() {

    }

    @Override
    protected void doOnSaveInstanceState(Bundle savedInstanceState) {

    }

    @Override
    public void responseError(int code, String msg) {

    }

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        // TODO: add setContentView(...) invocation
        ButterKnife.bind(this);
    }
}
